package com.yanqu.xiuxian.gameserver.tripletown.entity;

import java.util.ArrayList;
import java.util.List;

public class Monster {

    private int id;             // 怪id
    private int hp;             // 总血量
    private List<Integer> cols; // 占位（列）
    private int blood;          // 当前血量
    private int x;              // 占位：起始列
    private int y;              // 占位：起始行

    public Monster() {
        this.id = 0;
        this.hp = 0;
        this.cols = new ArrayList<>();
        this.blood = 0;
        this.x = 0;
        this.y = 0;
    }

    public Monster(int id, int hp, List<Integer> cols, int blood, int x, int y) {
        this.id = id;
        this.hp = hp;
        this.cols = cols;
        this.blood = blood;
        this.x = x;
        this.y = y;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getHp() {
        return hp;
    }

    public void setHp(int hp) {
        this.hp = hp;
    }

    public List<Integer> getCols() {
        return cols;
    }

    public void setCols(List<Integer> cols) {
        this.cols = cols;
    }

    public int getBlood() {
        return blood;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    /**
     * 减少血量
     *
     * @param blood 要减少的血量
     * @return true-死亡 false-生还
     */
    public boolean subtractBlood(int blood) {
        if (this.blood > blood) {
            this.blood -= blood;
            return false;
        } else {
            this.blood = 0;
            return true;
        }
    }

}
